#pragma once
#include <iostream>
#include <string>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>

class INetAddr
{
private:
    void Init()
    {
        _ip = inet_ntoa(_in.sin_addr);
        _port = ntohs(_in.sin_port);
    }
public:
    INetAddr(struct sockaddr_in add)
        :_in(add)
    {
        Init();
    }
    std::string IP()
    {
        return _ip;
    }
    uint16_t Port()
    {
        return _port;
    }
    ~INetAddr()
    {}
private:
    struct sockaddr_in _in;
    std::string _ip;
    uint16_t _port;
};